With the 'blockdestroyed' attribute you can set a script file that is called when a player destroys a block with the item. You can use world and player for your script.
blockdestroyed="loader.loadScript('xyz.script');";